function t(t, a, e) {
    return a in t ? Object.defineProperty(t, a, {
        value: e,
        enumerable: !0,
        configurable: !0,
        writable: !0
    }) : t[a] = e, t;
}

var a;

Page({
    data: (a = {
        mch_id: 0,
        postageIndex: -1,
        height: 0,
        beSubmit: !1,
        goods_id:0,
        form: {},
        forehead: -1,
        page_loading: !1,
        unit: "件",
        iphone_x: !1,
        modal: !1,
        error: !1,
        set_cat: !1,
        set_postage: !1,
        set_service: !1,
        confine: !1,
        goods_card: [],
        img: [],
        cat: [],
        card: [],
        goods_detail: [],
        beMove: !1,
        service: [],
        postage: [],
        actions: [ {
            name: "我知道啦",
            color: "#446dfd"
        } ],
        action: [ {
            name: "取消",
            color: "#666666"
        }, {
            name: "确认",
            color: "#446dfd",
            loading: !1
        } ],
        beCat: [ {
            label: "未选择"
        } ],
        beMchCat: [{
            label: "未选择"
        }],
        isChooseCat: [ "未选择" ],
        bePostage: "",
        beService: [],
        in_cat: "",
        newIndex: "0",
        index: "0",
        goods: null
    }, t(a, "form", {}), t(a, "attr", []), t(a, "have_children", !1), t(a, "disabled", !0), 
    t(a, "hidden", !0), t(a, "flag", !1), t(a, "x", 0), t(a, "y", 0), t(a, "elements", []), 
    t(a, "img_src", ""), a),
    _longtap: function(t) {
        var a = this;
        wx.createSelectorQuery().selectAll(".move-img").fields({
            dataset: !0,
            rect: !0
        }, function(t) {
            a.setData({
                elements: t
            });
        }).exec();
        t.detail;
        var e = t.currentTarget.dataset.src, i = t.currentTarget.dataset.index;
        this.data.img[i].pic_url = "", this.setData({
            x: t.currentTarget.offsetLeft,
            y: t.currentTarget.offsetTop
        }), this.setData({
            hidden: !1,
            flag: !0,
            beMove: !0,
            img_src: e,
            img: this.data.img,
            beginIndex: i
        });
    },
    touchend: function(t) {
        var a = this;
        if (this.data.flag) {
            for (var e = t.changedTouches[0].pageX, i = t.changedTouches[0].pageY, s = this.data.elements, r = this.data.img, o = this.data.beginIndex, n = 0; n < s.length; n++) {
                var d = s[n];
                if (e > d.left && e < d.right && i > d.top && i < d.bottom) {
                    var c = d.dataset.index;
                    if (o < c) {
                        for (var g = r[o], h = o; h < c; h++) r[h] = r[h + 1];
                        r[c] = g;
                    }
                    if (o > c) {
                        for (var u = r[o], p = o; p > c; p--) r[p] = r[p - 1];
                        r[c] = u;
                    }
                    r[c].pic_url = this.data.img_src, this.setData({
                        img: r
                    });
                }
            }
            a.data.img[o].pic_url || (a.data.img[o].pic_url = a.data.img_src, a.setData({
                img: a.data.img
            })), this.setData({
                hidden: !0,
                flag: !1,
                beMove: !1,
                beginIndex: null
            });
        }
    },
    touchm: function(t) {
        if (this.data.flag) {
            var a = t.touches[0].pageX, e = t.touches[0].pageY;
            this.setData({
                x: a - 60,
                y: e - 129
            });
        }
    },
    add_attr: function() {
        var t = this.data.attr, a = {
            attr_list: [ {
                attr_group_id: "1",
                attr_group_name: "规格",
                attr_id: 0,
                attr_name: ""
            } ],
            stock: "",
            price: "",
            no: "",
            weight: "",
            pic_url: "",
            share_commission_first: 0,
            share_commission_second: 0,
            share_commission_third: 0,
            member_price: {}
        };
        t.push(a), this.setData({
            attr: t
        });
    },
    pop: function(t) {
        var a = t.currentTarget.dataset.index, e = this.data.attr;
        e.splice(a, 1), this.setData({
            attr: e
        });
    },
    inputAttr: function(t) {
      var a = t.currentTarget.dataset.index, e = this.data.attr, attr = t.currentTarget.dataset.attr;
        e[a].attr_list[attr].attr_name = t.detail.value, e[a].attr_list[attr].attr_id = (+a + 2).toString(), 
        console.log(e[a], a, e), this.setData({
            attr: e
        });
    },
    inputPrice: function(t) {
        var a = t.currentTarget.dataset.index, e = this.data.attr;
        e[a].price = t.detail.value, this.setData({
            attr: e
        });
    },
    inputNum: function(t) {
        var a = t.currentTarget.dataset.index, e = this.data.attr;
        e[a].stock = t.detail.value, this.setData({
            attr: e
        });
    },
    inputNo: function(t) {
        var a = t.currentTarget.dataset.index, e = this.data.attr;
        e[a].no = t.detail.value, this.setData({
            attr: e
        });
    },
    inputWeight: function(t) {
        var a = t.currentTarget.dataset.index, e = this.data.attr;
        e[a].weight = t.detail.value, this.setData({
            attr: e
        });
    },
    name: function(t) {
        var a = this.data.form;
        a.name = t.detail.value, this.setData({
            form: a
        });
    },
    unit: function(t) {
        var a = this.data.form;
        a.unit = t.detail.value, this.setData({
            form: a,
            unit: t.detail.value
        });
    },
    sort: function(t) {
        var a = this.data.form;
        a.sort = t.detail.value, this.setData({
            form: a,
            sort: t.detail.value
        });
    },
    cost_price: function(t) {
        var a = this.data.form;
        a.cost_price = t.detail.value, this.setData({
            form: a
        });
    },
    original_price: function(t) {
        var a = this.data.form;
        a.original_price = t.detail.value, this.setData({
            form: a
        });
    },
    service_content: function (t) {
      var a = this.data.form;
      a.service = t.detail.value, this.setData({
        form: a
      });
    },
    price: function(t) {
        var a = this.data.form;
        a.price = t.detail.value, this.setData({
            form: a
        });
    },
    pieces: function(t) {
        var a = this.data.form;
        a.pieces = t.detail.value, this.setData({
            form: a
        });
    },
    forehead: function(t) {
        var a = this.data.form;
        a.forehead = t.detail.value, this.setData({
            form: a
        });
    },
    confineSwitch: function() {
        this.setData({
            confine: !this.data.confine
        });
    },
    confine_count: function(t) {
        var a = this.data.form;
        a.confine_count = t.detail.value, this.setData({
            form: a
        });
    },
    forehead_integral: function(t) {
        var a = this.data.form;
        a.forehead_integral = t.detail.value, this.setData({
            form: a
        });
    },
    give_integral: function(t) {
        var a = this.data.form;
        a.give_integral = t.detail.value, this.setData({
            form: a
        });
    },
    goods_num: function(t) {
        var a = this.data.form;
        a.goods_num = t.detail.value, this.setData({
            form: a
        });
    },
    getGoodsInfo: function () {
      var t = this;
      wx.showLoading()
      getApp().request({
        url: getApp().api.admin.goods.get_goods_info,
        data: {id:t.data.goods_id},
        method: "get",
        success: function (a) {
          wx.hideLoading()
          if (0 == a.code) {
            t.setData({
              img: a.data.goods_pic_list,
              goods: a.data.goods,
              form: a.data.form,
              attr: a.data.goods.attr,
              beCat: a.data.goods_cat_list ? a.data.goods_cat_list : [],
              in_cat: a.data.goods_cat_list.length > 0 ? a.data.goods_cat_list[0].name : [],
              bePostage: a.data.postageRiles ? a.data.postageRiles : t.data.bePostage
            })
            t.setData(a.data.form)
          } else wx.showToast({
            title: a.msg,
            icon: 'none'
          });
        },
        fale: function (t) {
          wx.hideLoading()
          wx.showToast({
            title: t.msg,
            icon: 'none'
          })
        }
      });
    },
    onLoad: function(t) {
        if (t.id > 0) {
          this.setData({
            goods_id: t.id
          })
          this.getGoodsInfo();
        }
    
        if (t.mch_id) {
            this.setData({
                mch_id: t.mch_id
            });
        }
        var a = this;
        getApp().page.onLoad(this, t);
        wx.getSystemInfo({
            success: function(t) {
                var e = t.windowHeight * (750 / t.windowWidth);
                a.setData({
                    height: e
                });
            }
        })
        var aa = wx.getSystemInfoSync();
        if (aa.model) {
          aa.model.indexOf("iphone_x") > -1 && this.setData({
            iphone_x: !0
          })
        }
        
         this.getCat(),this.data.mch_id > 0 && this.getMchCat(), this.getService(), this.getPostage(), this.getCard(), wx.removeStorage({
            key: "goods_card",
            success: function(t) {
                a.setData({
                    goods_card: []
                });
            }
        }), wx.removeStorage({
            key: "goods_detail",
            success: function(t) {
                a.setData({
                    goods_detail: []
                });
            }
        });
    },
    bindChange: function(t) {
        console.log(t);
        var a = t.detail.value[0];
        this.setData({
            newIndex: a
        });
    },
    close: function() {
        this.setData({
            modal: !this.data.modal,
            set_card: !1,
            set_cat: !1,
            set_service: !1,
            set_postage: !1
        });
    },
    add_img: function() {
        var t = this, a = 9 - t.data.img.length;
        wx.chooseImage({
            count: a,
            sizeType: [ "original", "compressed" ],
            sourceType: [ "album", "camera" ],
            success: function(a) {
                var e = a.tempFilePaths, i = t.data.img;
                e.forEach(function(a, s) {
                    wx.showLoading({
                        type: "loading"
                    }), wx.uploadFile({
                        url: getApp().api.default.upload_image,
                        filePath: a,
                        name: "image",
                        // formData: {
                        //     user: "test"
                        // },
                        success: function(a) {
                          wx.hideLoading()
                            var r = JSON.parse(a.data), o = {
                                pic_url: r.data.url,
                                id: r.data.id
                            };
                            0 == r.code && i.push(o), t.setData({
                                img: i
                            }), s == e.length - 1;
                        }
                    });
                });
            }
        });
    },
    del_img: function(t) {
        var a = t.currentTarget.dataset.index, e = this.data.img;
        e.splice(a, 1), this.setData({
            img: e
        });
    },
    chooseCat: function() {
        0 == this.data.cat.length ? this.setData({
            modal: !0,
            set_cat: !0
        }) : this.setData({
            choose_list: this.data.cat,
            dialog: !0,
            set_cat: !0,
            in_cat: null,
            index: 0,
            have_children: !1,
            beCat: [ {
                label: "未选择"
            } ],
            isChooseCat: [ "未选择" ]
        });
    },
    chooseMchCat: function () {
        0 == this.data.mch_cat.length ? this.setData({
            modal: !0,
            set_mch_cat: !0
        }) : this.setData({
            choose_list: this.data.mch_cat,
            dialog: !0,
            set_mch_cat: !0,
            in_mch_cat: null,
            index: 0,
            have_children: !1,
            beMchCat: [{
                label: "未选择"
            }],
            isChooseCat: ["未选择"]
        });
    },
    choose_cat: function() {
        var t = this.data.beCat, a = !1, e = this.data.cat[this.data.newIndex], i = this.data.index;
        if (this.data.have_children && (e = t[i - 1].children[this.data.newIndex - 1]), 
        t[i] = e, this.setData({
            choose_list: []
        }), i++, e) {
            var s = [];
            if (t.forEach(function(t, a) {
              s.push(t.name);
            }), s.push("未选择"), this.setData({
                isChooseCat: s
            }), e.children) {
                var r = [];
                r[0] = {
                  name: "不选择"
                }, e.children.forEach(function(t) {
                    r.push(t);
                }), a = !0, this.setData({
                    choose_list: r
                });
            } else {
                var o = void 0;
                t.forEach(function(t, a) {
                  t.name.length > 20 && (t.name = t.label.slice(0, 20) + "..."), 0 == a ? o = t.name : o += "/" + t.name;
                }), this.setData({
                    in_cat: o,
                    dialog: !1,
                    set_cat: !1
                });
            }
        } else {
            t.pop();
            var n = void 0;
            t.forEach(function(t, a) {
                0 == a ? n = t.label : n += "/" + t.label;
            }), this.setData({
                in_cat: n,
                dialog: !1,
                set_cat: !1
            });
        }
        this.setData({
            newIndex: "0",
            beCat: t,
            index: i,
            have_children: a
        });
    },
    choose_mch_cat: function () {
        var t = this.data.beMchCat, a = !1, e = this.data.mch_cat[this.data.newIndex], i = this.data.index;
        if (this.data.have_children && (e = t[i - 1].children[this.data.newIndex - 1]),
            t[i] = e, this.setData({
                choose_list: []
            }), i++ , e) {
            var s = [];
            if (t.forEach(function (t, a) {
                s.push(t.name);
            }), s.push("未选择"), this.setData({
                isChooseCat: s
            }), e.children) {
                var r = [];
                r[0] = {
                    label: "不选择"
                }, e.children.forEach(function (t) {
                    r.push(t);
                }), a = !0, this.setData({
                    choose_list: r
                });
            } else {
                var o = void 0;
                t.forEach(function (t, a) {
                    t.name.length > 5 && (t.name = t.name.slice(0, 4) + "..."), 0 == a ? o = t.name : o += "/" + t.name;
                }), this.setData({
                    in_mch_cat: o,
                    dialog: !1,
                    set_mch_cat: !1
                });
            }
        } else {
            t.pop();
            var n = void 0;
            t.forEach(function (t, a) {
                0 == a ? n = t.label : n += "/" + t.label;
            }), this.setData({
                in_mch_cat: n,
                dialog: !1,
                set_mch_cat: !1
            });
        }
        this.setData({
            newIndex: "0",
            beMchCat: t,
            index: i,
            have_children: a
        });
    },
    toggle: function(t) {
        var a = t.currentTarget.dataset.status;
        if (2 == a) this.setData({
            choose_list: [],
            dialog: !1,
            set_cat: !1,
            set_postage: !1
        }); else if (1 == a && this.data.set_postage) {
            var e = this.data.postage[this.data.newIndex];
            this.setData({
                bePostage: e,
                choose_list: [],
                dialog: !1,
                set_cat: !1,
                set_postage: !1
            });
        }
    },
    getCat: function() {
        var t = this;
        wx.showLoading()
        getApp().request({
            url: getApp().api.admin.goods.get_cat,
            method: "get",
            success:function (a) {
              wx.hideLoading()
              if ( 0 == a.code) {
                var e = a.data.list;
                t.setData({
                  cat: e
                });
              } else wx.showToast({
                title: a.msg,
                icon: 'none'
              });
            },
            fale: function (t) {
              wx.hideLoading()
              wx.showToast({
                title: t.msg,
                icon: 'none'
              })
            }
        });
    },
    getMchCat: function () {
        var t = this;
        wx.showLoading()
        getApp().request({
            url: getApp().api.admin.goods.get_mch_cat,
            data: {mch_id: t.data.mch_id},
            method: "get",
            success: function (a) {
                wx.hideLoading()
                if (0 == a.code) {
                    var e = a.data.list;
                    t.setData({
                        mch_cat: e
                    });
                } else wx.showToast({
                    title: a.msg,
                    icon: 'none'
                });
            },
            fale: function (t) {
                wx.hideLoading()
                wx.showToast({
                    title: t.msg,
                    icon: 'none'
                })
            }
        });
    },
    chooseExpress: function() {
        var t = this;
        wx.showLoading()
        getApp().request({
            url: getApp().api.admin.goods.postage,
            data: {
                mch_id: t.data.mch_id
              },
            method: "get",
            success: function(a) {
              wx.hideLoading()
              if (0 == a.code) {
                var e = a.data.list;
                if (0 == e.length) t.setData({
                  set_postage: !0,
                  modal: !0,
                  postage: e
                }); else {
                  var i = [];
                  e.forEach(function (t, a) {
                    i.push(e[a].id);
                  });
                  var s = i.indexOf(t.data.bePostage.id);
                  s > -1 ? t.setData({
                    postageIndex: s,
                    newIndex: s
                  }) : t.setData({
                    bePostage: t.data.goods_id ? t.data.bePostage : ""
                  }), t.setData({
                    set_postage: !0,
                    dialog: !0,
                    postage: e
                  });
                }
              }
            }
        });
    },
    chooseService: function() {
      return [];
        var t = this;
        getApp().request({
            url: getApp().apiUrl.app_admin.service,
            method: "get"
        }).then(function(a) {
            if (getApp().iView.$Toast.hide(), 0 == a.data.code) {
                var e = a.data.data.list, i = [];
                e.forEach(function(t) {
                    t.isChoose = !1, 1 == t.is_default && (i.push(t), t.isChoose = !0);
                }), t.setData({
                    service: e,
                    beService: i
                }), 0 == e.length ? t.setData({
                    set_service: !0,
                    modal: !0
                }) : t.setData({
                    set_service: !0,
                    is_service: !0
                });
            } else getApp().iView.$Toast({
                content: a.data.msg,
                duration: 2,
                type: "warning"
            });
        });
    },
    chooseCard: function() {
        var t = this;
        wx.showLoading();
        getApp().request({
            url: getApp().api.admin.goods.card,
            method: "get",
            success: function(a) {
              wx.hideLoading()
              if (0 == a.code) {
                var e = a.data.list;
                t.setData({
                  card: e
                }), 0 == e.length ? t.setData({
                  set_card: !0,
                  modal: !0
                }) : [];
              } else wx.showToast({
                title: a.msg,
                icon: 'none'
              });
            }
        });
    },
    choose: function(t) {
        var a = this.data.beService, e = t.currentTarget.dataset.detail;
        this.data.service.forEach(function(t) {
            t.id == e.id && (t.isChoose = !t.isChoose);
        }), this.setData({
            beService: a,
            service: this.data.service
        });
    },
    submitService: function(t) {
        var a = t.detail.index;
        if (0 === a) {
            var e = this.data.beService, i = this.data.service;
            e.length > 0 ? i.forEach(function(t, a) {
                t.isChoose = !1, e.forEach(function(a) {
                    a.id == t.id && (t.isChoose = !0);
                });
            }) : i.forEach(function(t, a) {
                t.isChoose = !1;
            }), this.setData({
                beService: e,
                service: i,
                set_service: !1,
                is_service: !1
            });
        } else if (1 === a) {
            var s = [];
            this.data.service.forEach(function(t) {
                t.isChoose && s.push(t);
            }), this.setData({
                beService: s,
                set_service: !1,
                is_service: !1
            });
        }
    },
    getService: function() {
        var t = this;
        return [];
        getApp().request({
            url: getApp().apiUrl.app_admin.service,
            method: "get"
        }).then(function(a) {
            if (getApp().iView.$Toast.hide(), 0 == a.data.code) {
                var e = a.data.data.list, i = [];
                e.forEach(function(t) {
                    t.isChoose = !1, 1 == t.is_default && (i.push(t), t.isChoose = !0);
                }), t.setData({
                    service: e,
                    beService: i
                });
            } else getApp().iView.$Toast({
                content: a.data.msg,
                duration: 2,
                type: "warning"
            });
        }).catch(function(t) {
            getApp().iView.$Toast({
                content: t.data.msg,
                duration: 2,
                type: "error"
            });
        });
    },
    getCard: function() {
        var t = this;
        getApp().request({
            url: getApp().api.admin.goods.card,
            method: "get",
            success: function (a) {
              if ( 0 == a.code) {
                var e = a.data.list;
                t.setData({
                  card: e
                });
              } else wx.showToast({
                title: a.msg,
                icon: 'none'
              });
            },
            fale: function() {
              wx.showToast({
                title: t.msg,
                icon: 'none'
              });
            }
        });
    },
    getPostage: function() {
        var t = this;
        getApp().request({
            url: getApp().api.admin.goods.postage,
            method: "get",
            success:function (a) {
              wx.hideLoading()
              if ( 0 == a.code) {
                var e = a.data.list, i = "";
                e.forEach(function (t) {
                  1 == t.status && (i = t);
                }), t.setData({
                  postage: e,
                  bePostage: t.data.goods_id ? t.data.bePostage : i
                });
              } else wx.showToast({
                title: a.msg,
                icon: 'none'
              });
            },
            fale: function(t) {
              wx.showToast({
                title: t.msg,
                icon: 'none'
              });
            }
        });
    },
    submit: function() {
        var t = !1, a = this, e = a.data.form;
        if (!(a.data.img.length > 0)) return a.setData({
            error: "请上传商品图片"
        }), !1;
        if (e.pic_url = a.data.img, !e.name) return a.setData({
            error: "请设置商品名称"
        }), !1;
        if (e.cats = [], a.data.beCat[0] && "未选择" == a.data.beCat[0].label) return a.setData({
            error: "请设置商品分类"
        }), !1;
        if (a.data.beCat.forEach(function(t) {
            e.cats.push(t.id);
        }), e.mchCats = [], a.data.beMchCat[0] && "未选择" == a.data.beMchCat[0].label && a.data.mch_id > 0) return a.setData({
            error: "请设置多商户商品分类"
        }), !1;
        if (a.data.beMchCat.forEach(function (t) {
            e.mchCats.push(t.id);
        }),!a.data.unit) return a.setData({
            error: "请设置商品单位"
        }), !1;
        
        if (e.unit || (e.unit = a.data.unit), !e.cost_price) return a.setData({
            error: "请设置商品成本价"
        }), !1;
        if (e.cost_price < 0) return a.setData({
            error: "成本价不得小于零"
        }), !1;
        if (!e.original_price) return a.setData({
            error: "请设置商品原价"
        }), !1;
        if (e.original_price < 0) return a.setData({
            error: "商品原价不得小于零"
        }), !1;
        if (a.data.attr.length > 0 && e.use_attr == 1) e.goods_num = 0, a.data.attr.forEach(function(e, i) {
          return a.data.attr[i].attr_list[0].attr_name ? a.data.attr[i].price ? (a.data.attr[i].stock>0 || a.data.attr[i].num>0) ? void (i == a.data.attr.length - 1 && (t = !0)) : (a.setData({
                error: "请输入规格库存"
            }), !1) : (a.setData({
                error: "请输入规格售价"
            }), !1) : (a.setData({
                error: "请输入规格名"
            }), !1);
        }), e.attr = a.data.attr; else {
            if (e.use_attr = 0, e.attr = [], !e.price) return a.setData({
                error: "请设置商品售价"
            }), !1;
            if (!e.goods_num) return a.setData({
                error: "商品库存不得为空"
            }), !1;
            if (e.price < .01) return a.setData({
                error: "商品售价不得小于零"
            }), !1;
            t = !0;
        }
        if (e.cards = a.data.goods_card, e.services = [], a.data.beService.length > 0 && (e.services = a.data.beService), 
        e.status = a.data.mch_id > 0 ? 0 : 1, e.virtual_sales = 0, e.cover_pic = "", e.sort = 100, e.accumulative = 1, 
        e.member_price = {}, (a.data.mch_id > 0 ? true : e.mchCats = []), !(a.data.goods_detail.length > 0 || a.data.goods)) return a.setData({
            error: "请设置图文描述"
        }), !1;
        if (a.data.goods_detail.length > 0) {
          e.detail = "", a.data.goods_detail.forEach(function (t) {
            e.detail += "<p><img src=" + t.pic_url + "></p>";
          })
        }else {
          e.detail = a.data.goods.detail
        }
        
         e.forehead_integral && (e.forehead_integral > 0 ? e.forehead_integral_type : (e.forehead_integral_type, 
        e.forehead_integral = e.forehead_integral.replace("%", ""))), e.give_integral && (e.give_integral > 0 ? e.give_integral_type : (e.give_integral_type, 
        e.give_integral = e.give_integral.replace("%", ""))), e.freight_id = a.data.bePostage.id, e.sort = a.data.sort ? a.data.sort : 1000, 
        e.freight = a.data.bePostage, e.individual_share = 0, e.is_level = 0, e.individual_share = 0, 
        e.video_url = "", e.mch_id = a.data.mch_id,t && a.setData({
            form: e,
            beSubmit: !0
        });
    },
    toSubmit: function() {
        wx.showLoading();
        var self = this;
        getApp().request({
            url: getApp().api.admin.goods.edit + '&mch_id=' + self.data.mch_id,
            data: {
                form: JSON.stringify(this.data.form)
            },
            method: "post",
            success: function (t) {
              wx.hideLoading(), 0 == t.code ? (wx.showToast({
                title: t.msg,
                icon: 'none'
              }), wx.setStorage({
                key: "goods_status",
                data: "保存成功"
              }), setTimeout(function () {
                if (self.data.mch_id > 0) {
                    wx.navigateTo({
                        url: "/mch/m/goods/goods?status=3"
                    });
                } else {
                    wx.navigateBack();
                }
                //wx.navigateBack();
              }, 500)) : wx.showToast({
                title: t.msg,
                icon:'none'
              });
            },
            fale: function(t) {
              wx.showToast({
                title: t.msg,
                icon: 'none'
              })
            }
        });
    },
    cancel: function() {
        this.setData({
            beSubmit: !1
        });
    },
    getError: function() {
        this.setData({
            error: !1
        });
    },
    onReady: function(t) {
        this.setData({
            page_loading: !1
        });
    },
    onShow: function() {
        var t = this;
        wx.getStorage({
            key: "goods_card",
            success: function(a) {
                t.setData({
                    goods_card: a.data
                });
            }
        }), wx.getStorage({
            key: "goods_detail",
            success: function(a) {
                t.setData({
                    goods_detail: a.data
                });
            }
        });
    },
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {},
    switchUseAttr(e) {
      var goods = this.data.goods
      if (e.detail.value) {
        goods.use_attr = 1
        this.setData({
          goods: goods
        })
      } else {
        goods.use_attr = 0
        this.setData({
          goods: goods
        })
      }
    }
});